/*
 * Copyright (c) GoKeep by gokeep.org. 2022-2023. All rights reserved
 */
package org.gokeep.application.rest;

import jakarta.annotation.Resource;
import org.gokeep.application.entity.Test;
import org.gokeep.application.repository.TestRepository;
import org.gokeep.common.document.User;
import org.gokeep.communication.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/test")
public class TestApi {

    @Resource
    private TestRepository testRepository;


    @Resource
    private UserService userService;

    @GetMapping("/mybatis-plus")
    public List<Test> getTest() {
        return testRepository.findAll();
    }


    @GetMapping("/user/{userId}")
    public User getUser(@PathVariable("userId") String userId) {
        return userService.getUserById(userId);
    }
}
